package com.diaohw.module.log.service.handle;

import cn.hutool.core.bean.BeanUtil;
import com.diaohw.module.log.obj.entity.DbLog;
import com.diaohw.module.log.obj.entity.RequestLog;
import com.diaohw.module.log.service.LogStorageService;
import com.diaohw.platform.common.LogProcessAPI;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class LogProcessHandle implements LogProcessAPI {

    @Resource
    private LogStorageService storageService;

    @Override
    public void http(com.diaohw.platform.common.obj.log.RequestLog requestLog) {
        RequestLog log = BeanUtil.toBean(requestLog, RequestLog.class);
        storageService.storageHttpLog(log);
    }

    @Override
    public void db(com.diaohw.platform.common.obj.log.DbLog dbLog) {
        DbLog log = BeanUtil.toBean(dbLog, DbLog.class);
        storageService.storageDBLog(log);
    }
}
